package com.example.model.domain

import com.example.model.dataobject.UserDO
import com.example.model.dataobject.UserProfileDO

/**
 *
 *
 * @author wangli
 * @date 2025-10-09
 */
class User {
    var id: Long? = null
    var username: String? = null
    var password: String? = null
    var email: String? = null
    var userProfile: UserProfile? = null

    constructor(id: Long?, username: String?, email: String?, password: String?, userProfile: UserProfile?) {
        this.id = id
        this.username = username
        this.email = email
        this.password = password
        this.userProfile = userProfile
    }

    fun createUser(): UserDO {
        val userDO = UserDO()
        userDO.username = this.username
        userDO.password = this.password
        userDO.email = this.email
        return userDO
    }

    fun createUserProfile(userId: Long): UserProfileDO {
        val userProfileDO = UserProfileDO()
        userProfileDO.userId = userId
        userProfileDO.firstName = this.userProfile?.firstName
        userProfileDO.lastName = this.userProfile?.lastName
        userProfileDO.phoneNumber = this.userProfile?.phoneNumber
        userProfileDO.address = this.userProfile?.address
        return userProfileDO
    }
}